//
//  SceneManager.m
//  Line98
//
//  Created by Louis CHU on 16/04/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "SceneManager.h"
static SceneManager * s_sharedSceneManager;

@interface SceneManager ()
@end

@implementation SceneManager
@synthesize renderers;
@synthesize updaters;
+ (SceneManager *) sharedSceneManager
{
    if (!s_sharedSceneManager) {
        s_sharedSceneManager = [SceneManager new];
    }
    return s_sharedSceneManager;
}

- (NSMutableArray *) renderers 
{
    if(!renderers)
    {
        renderers = [NSMutableArray array];
    }
    return renderers;
}

- (NSMutableArray *) updaters 
{
    if(!updaters)
    {
        updaters = [NSMutableArray array];
    }
    return updaters;
}

- (void) update: (float) elapsedTime step:(int) step
{
    for(id<IUpdater> updater in self.updaters)
    {
        [updater update:elapsedTime step:step];
    }
    
    for(id<IRenderer> renderer in self.renderers)
    {
        [renderer render];
    }
}

@end
